package com.asher.zxingmodule;

import com.google.zxing.Result;
import com.google.zxing.client.ohos.camera.CameraManager;
import com.google.zxing.client.ohos.camera.DecodeHandler;
import com.google.zxing.client.ohos.camera.ScanAbilityHandler;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.eventhandler.EventHandler;
import ohos.eventhandler.EventRunner;
import ohos.media.image.PixelMap;

import java.util.logging.Handler;

public class BaseAbility extends Ability {
    protected ScanAbilityHandler mEventHandler;
    protected DecodeHandler decodeHandler;
    protected CameraManager cameraManager;
    protected PixelMap resultMap;

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        mEventHandler = new ScanAbilityHandler(EventRunner.getMainEventRunner(),this);
        decodeHandler = new DecodeHandler(EventRunner.create("decode"),this);
    }

    public EventHandler getAbilityHandler(){
        return mEventHandler;
    }
    public EventHandler getDecodeHandler(){
        return decodeHandler;
    }

    public CameraManager getCameraManager(){
        return cameraManager;
    }

    public void onDecodeSuccess(Result result){

    }

    public void setResultPixelMap(PixelMap map){
        this.resultMap = map;
    }

    public void triContinue(){

    }

    public void onDecodeFail(){

    }
}
